<?php
require_once("../include/conn.php");
$table=$tb_dz;
$id=0;
$action=$title=$nname='';
if (isset($_GET['name'])) {
	$nname=$_REQUEST['name'];
}
if (isset($_GET['id'])) {
	$id=intval($_REQUEST['id']);
}
if (isset($_GET['action'])) {
	$action=$_REQUEST['action'];
}
if ($nname=='1') {
	$table=$tb_rk;
}
if ($action=='resume' && $id<>'0' ) {//统一还原操作 
	$sql="update $table set `isdel`='0' where id = $id";
	$cn=mysql_db_query($db_name,$sql);
}elseif($action=='delete' && $id<>'0' ) {//统一记录删除操作 
	$sql="update $table set `isdel`='1' where id = $id";
	$cn=mysql_db_query($db_name,$sql);
}elseif($action=='pack' && $id<>'0' ) {//统一彻底删除操作 
	$sql="DELETE  FROM   $table where id = $id";
	$isdel=mysql_db_query($db_name,$sql);
	if ($isdel && $nname<>'1') {//基本信息删除后，还要删除相应图片信息等
		$ispic="select * from $tb_mp where bl_id = $id ";
		$cn_ma=mysql_db_query($db_name,$ispic);
		while($row_ma = mysql_fetch_array($cn_ma)) {//先删除对应附件，然后再删除数据库记录
			$file='..'.$row_ma['url'];
//			echo '<br>file='.$file;
			unlink($file);
		}	 
		$sql="DELETE  FROM   $tb_mp where bl_id = $id";
		$isdel=mysql_db_query($db_name,$sql);		
	}
//优化数据表
$youtb[]=$table;
foreach ($youtb as $tb) {
	$youhuan="OPTIMIZE TABLE $tb ";
	mysql_db_query($db_name,$youhuan);
}


	
	
	
}else{//统一错误操作 
	self("参数错误","admin_index.php");
}
if ($nname=='1') {
	self("操作成功!","Admin_scrk.php");
}else {
	self("操作成功!","info_mange.php?name=$nname");
}
?>
